#include "ServerHelloWorldRequestHandler.h"
#include "Poco/Net/HTTPServerRequest.h"
#include "Poco/Net/HTTPServerResponse.h"

using Poco::Net::HTTPServerRequest;
using Poco::Net::HTTPResponse;


ServerHelloWorldRequestHandler::ServerHelloWorldRequestHandler() { }

void ServerHelloWorldRequestHandler::handleRequest(HTTPServerRequest &request, HTTPServerResponse &response)
{
	_log.information("Request from " + request.clientAddress().toString());

	response.setChunkedTransferEncoding(true);
	response.setContentType("text/html");

	std::ostream &ostr = response.send();
	ostr << "<html><head><title>ServerRequestHandler powered by POCO C++ Libraries</title>";
	ostr << "<meta http-equiv=\"refresh\" content=\"30\"></head>";
	ostr << "<body>";
	ostr << "Hello World! ServerHelloWorldRequestHandler.";
	ostr << "</body></html>";
}
